<?php

use Welcomescreen\Agavi\Action;

class Backend_Visits_UploadFileAction extends Action\BackendBaseAction {
	public function executeWrite(AgaviWebRequestDataHolder $rd) {
		$file = $rd->getFile('file');
		$uploadDir = AgaviConfig::get('org.welcomescreen.system.upload_dir');
		$fileName = AgaviToolkit::uniqid() . $file->getName();
		$path = $uploadDir . '/' . $fileName;
		$file->move($path);
		$this->setAttribute('path', $path);
		$this->setAttribute('fileName', $fileName);
		
		return 'Success';
	}
}

?>